package org.eu.hdeogratias.license.model;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

/**
 * 许可证检查
 *
 * @author weitao
 */
public class LicenseCheck implements Serializable {
    private static final long serialVersionUID = 1L;


    public LicenseCheck() {
    }

    public LicenseCheck(List<String> ipAddress, List<String> macAddress, String cpuSerial, String mainBoardSerial) {
        this.ipAddress = ipAddress;
        this.macAddress = macAddress;
        this.cpuSerial = cpuSerial;
        this.mainBoardSerial = mainBoardSerial;
    }

    /**
     * 可被允许的 IP  地址
     */
    private List<String> ipAddress;

    /**
     * 可被允许的 MAC 地址
     */
    private List<String> macAddress;

    /**
     * 可被允许的 CPU 序列号
     */
    private String cpuSerial;

    /**
     * 可被允许的主板序列号
     */
    private String mainBoardSerial;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public List<String> getIpAddress() {
        return ipAddress;
    }

    public void setIpAddress(List<String> ipAddress) {
        this.ipAddress = ipAddress;
    }

    public List<String> getMacAddress() {
        return macAddress;
    }

    public void setMacAddress(List<String> macAddress) {
        this.macAddress = macAddress;
    }

    public String getCpuSerial() {
        return cpuSerial;
    }

    public void setCpuSerial(String cpuSerial) {
        this.cpuSerial = cpuSerial;
    }

    public String getMainBoardSerial() {
        return mainBoardSerial;
    }

    public void setMainBoardSerial(String mainBoardSerial) {
        this.mainBoardSerial = mainBoardSerial;
    }

    @Override
    public String toString() {
        return "LicenseCheck{" +
                "ipAddress=" + ipAddress +
                ", macAddress=" + macAddress +
                ", cpuSerial='" + cpuSerial + '\'' +
                ", mainBoardSerial='" + mainBoardSerial + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        LicenseCheck that = (LicenseCheck) o;

        if (!Objects.equals(ipAddress, that.ipAddress)) return false;
        if (!Objects.equals(macAddress, that.macAddress)) return false;
        if (!Objects.equals(cpuSerial, that.cpuSerial)) return false;
        return Objects.equals(mainBoardSerial, that.mainBoardSerial);
    }

    @Override
    public int hashCode() {
        int result = ipAddress != null ? ipAddress.hashCode() : 0;
        result = 31 * result + (macAddress != null ? macAddress.hashCode() : 0);
        result = 31 * result + (cpuSerial != null ? cpuSerial.hashCode() : 0);
        result = 31 * result + (mainBoardSerial != null ? mainBoardSerial.hashCode() : 0);
        return result;
    }
}
